package com.wildwolf.project.wildwolf.model;

import android.os.Parcel;
import android.os.Parcelable;

/**
 * 连接中的用户信息
 * 
 * @author LEON
 * 
 */
public class UserInfo implements Parcelable {

	/** Parcelable.Creator needs by Android. */
	public static final Parcelable.Creator<UserInfo> CREATOR = new Parcelable.Creator<UserInfo>() {

		@Override
		public UserInfo createFromParcel(Parcel source) {
			return new UserInfo(source);
		}

		@Override
		public UserInfo[] newArray(int size) {
			return new UserInfo[size];
		}
	};

	private final String accountName;
	
	private String avatarId;

	private UserInfo(final Parcel in) {
		accountName = in.readString();
		avatarId = in.readString();
	}

	/**
	 * Constructor.
	 * 
	 * @param 
	 */
	public UserInfo(final String jid) {
		// 大小写敏感
		accountName = jid;
	}

	@Override
	public void writeToParcel(Parcel dest, int flags) {
		dest.writeString(accountName);
		dest.writeString(avatarId);
	}

	@Override
	public int describeContents() {
		return 0;
	}

	/**
	 * 返回用户的头像
	 * 
	 * @return
	 */
	public String getAvatarId() {
		return avatarId;
	}

	/**
	 * 设置用户的头像
	 * 
	 * @param avatarId
	 */
	public void setAvatarId(String avatarId) {
		this.avatarId = avatarId;
	}

	/**
	 * 返回用户的账户名
	 * 
	 * @return
	 */
	public String getJid() {
		return accountName;
	}
}
